package cn.lcsjsxy.yxc.multithreading.synchronization;

class MyThread extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            if (i % 2 == 0)
                System.out.println(Thread.currentThread().getName() + ":" + i);
        }
    }
}

public class ThreadDemo extends MyThread {
    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        myThread.start();

        MyThread myThread1=new ThreadDemo();
        myThread1.start();
    }

    @Override
    public void run() {
        for (int i = 0; i < 100; i++)
            if (i % 2 == 1)
                System.out.println(Thread.currentThread().getName()+":"+i);
    }
}
